<?php $this->layout='main' ?>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/admin/common-script.js"></script>

<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.tooltip.css" />
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.bgiframe.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.dimensions.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.tooltip.js"></script>

<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.jscrollpane.min.js"></script>
<!--
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/demo.js"></script>
-->
<script type="text/javascript" id="sourcecode">
			$(function()
			{
				$('.scroll-pane-arrows2').jScrollPane(
					{
						showArrows: true,
						horizontalGutter: 10
					}
				);
			});
</script>

<script type="text/javascript" id="sourcecode2">
			$(function()
			{
				$('.scroll-pane-arrows3').jScrollPane(
					{
						showArrows: true,
						horizontalGutter: 10
					}
				);
			});
</script>

<script>
var previousBidRequestsID=0;//most recent bid request auction ID
var previousActiveBidsID=0;//most recent active bid auction ID
var previousOpenOrdersID=0;//most recent open order ID
var previousBidHistoryID=0;//most recent closed order ID

/*
* display the new selected auction info 
*/
function displayAuctionDetails(data)
{
	if(data!=null)
	{
		var auction=data[0];
		var product=data[2];
		var tank=data[1];
		var site=data[3];
		var table = document.getElementById('oo-details');
		table.children[0].innerHTML='<b>Auction ID:</b> '+auction.auction_ID;//auction ID
		table.children[1].innerHTML='<b>Product:</b> '+product.product_name;//product name
		table.children[2].innerHTML='<b>Gallons Req.:</b> '+auction.gallon;// gallons
		table.children[3].innerHTML='<b>Inv. Last Read:</b> '+tank.inventory_last_read;//inventory last read
		table.children[4].innerHTML='<b>Inv. Last Time:</b> '+tank.inventory_last_time;//inventory last time
		table.children[5].innerHTML='<b>Auction Start Date/Time:</b> '+auction.auction_start;//auction start time
		table.children[6].innerHTML='<b>Auction End Date/Time:</b> '+auction.auction_end;//auction end time
		table.children[7].innerHTML='<b>Delivery Requested Date/Time:</b> '+auction.delivery_due;//delivery due time
		if(site.notes!=null)
			table.children[8].innerHTML='<b>Delivery notes:</b> '+site.notes;//site delivery notes
		else
			table.children[8].innerHTML='<b>Delivery notes:</b> ';
		if(auction.notes!=null)
			table.children[9].innerHTML='<b>auction notes:</b> '+auction.notes;//auction notes
		else
			table.children[9].innerHTML='<b>auction notes:</b> ';
		
		//send request of displaying site details
		$.ajax({
	       url: '<?php echo CController::createUrl('auctions/siteDetails');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {site_ID:site.site_ID, tank_ID:tank.tank_ID},
	       success: updateSiteDetails
	     });
	}
}

/*
* create a new tooltip,
* display the site details info in the tooltip,
* after changing the selected auction
*/
function updateSiteDetails(data)
{
	var result='';
	
	var tank=data[0];
	var site=data[1];
	var rack=data[2];
	var tools=data[3];
	var tankType=data[4];
	var tankPosition=data[5];
	var tankMonitor=data[6];
	
	result+='<b>SITE ID:</b> '+site.site_ID+'</br>';
	result+='<b>SITE NAME:</b> '+site.site_name+'</br>';
	result+='<b>Address 1:</b> '+site.address1+'</br>';
	result+='<b>Address 2:</b> '+site.address2+'</br>';
	result+='<b>City/State/Zip:</b> '+site.city+', '+site.state+', '+site.zip+'</br>';
	result+='<b>County:</b> '+site.county+'</br>';
	result+='<b>Home Rack:</b> '+rack.city+', '+rack.state+'</br>';
	if(site.gated==1)
	{
		result+='<b>Gated:</b> YES</br>';
		result+='<b>Gated Hours:</b> '+site.gate_opens+'-'+site.gate_closes+'</br>';
	}
	else
	{
		result+='<b>Gated:</b> NO</br>';
	}
	if(site.security_on_premises==1)
	{
		result+='<b>Hour of Operations:</b> '+site.open_time+'-'+site.close_time+'</br>';
	}
	for(var i=0;i<tools.length;i++)
	{
		result+='<b>'+tools[i].tool_name+':</b> YES</br>';
	}
	result+='</br>';
	
	result+='<b>TANK ID:</b> '+tank.tank_ID+'</br>';
	result+='<b>TANK NAME:</b> '+tank.tank_name+'</br>';
	result+='<b>Type of Tank:</b> '+tankType.tank_type_description+'</br>';
	result+='<b>Orientation:</b> '+tankPosition.tank_position_description+'</br>';
	if(tankMonitor!=null)
	{
		result+='<b>Tank Monitor MFG:</b> '+tankMonitor.monitor_MFG+'</br>';
		result+='<b>Tank Monitor Model:</b> '+tankMonitor.monitor_model+'</br>';
	}
	if(tank.remote_fill==1)
	{
		result+='<b>Remote Fill:</b> YES</br>';
	}
	if(tank.overfill_alarm==1)
	{
		result+='<b>Overfill Alarm:</b> YES</br>';
	}
	result+='</br>';
	
	result+='<b>Contact Name:</b> '+site.contact_name+'</br>';
	result+='<b>Phone# of Site:</b> '+site.phone_number_of_site+'</br>';
	result+='<b>After Hour #:</b> '+site.after_hour_number+'</br>';
	
	$("#site-details-button").tooltip({
    	bodyHandler: function() {
	     return result;
	   },
	   showURL: false,
    });
}

/*
* param: the tab link user clicked
* focus on the bid requests tab
* display the content under the bid requests tab
*/
function displayBidRequests(element)
{ 
	clearAuctionDetails()
	document.getElementById("area-title").innerHTML='the bid requests';
	activateTab(element, 'br');
	var bidrequestsArea = document.getElementById('bid-requests-area');
	bidrequestsArea.style.display='block';
	var actionsbidrequestsArea = document.getElementById('actions-bid-requests');
	actionsbidrequestsArea.style.display='block';
	
	var activebidsArea = document.getElementById('active-bids-area');
	activebidsArea.style.display='none';
	var actionsactivebidsArea = document.getElementById('actions-active-bids');
	actionsactivebidsArea.style.display='none';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='none';
	var actionsopenordersArea = document.getElementById('actions-open-orders');
	actionsopenordersArea.style.display='none';
	
	var bidhistoryArea = document.getElementById('bid-history-area');
	bidhistoryArea.style.display='none';
	var actionsbidhistoryArea = document.getElementById('actions-bid-history');
	actionsbidhistoryArea.style.display='none';
}

/*
* param: the tab link user clicked
* focus on the active bids tab
* display the content under the active bids tab
*/
function displayActiveBids(element)
{ 
	clearAuctionDetails()
	document.getElementById("area-title").innerHTML="my active bids";
	activateTab(element, 'br');
	var bidrequestsArea = document.getElementById('bid-requests-area');
	bidrequestsArea.style.display='none';
	var actionsbidrequestsArea = document.getElementById('actions-bid-requests');
	actionsbidrequestsArea.style.display='none';
	
	var activebidsArea = document.getElementById('active-bids-area');
	activebidsArea.style.display='block';
	var actionsactivebidsArea = document.getElementById('actions-active-bids');
	actionsactivebidsArea.style.display='block';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='none';
	var actionsopenordersArea = document.getElementById('actions-open-orders');
	actionsopenordersArea.style.display='none';
	
	var bidhistoryArea = document.getElementById('bid-history-area');
	bidhistoryArea.style.display='none';
	var actionsbidhistoryArea = document.getElementById('actions-bid-history');
	actionsbidhistoryArea.style.display='none';
}

/*
* param: the tab link user clicked
* focus on the open orders tab
* display the content under the open orders tab
*/
function displayOpenOrders(element)
{ 
	clearAuctionDetails()
	document.getElementById("area-title").innerHTML="the open orders";
	activateTab(element, 'br');
	var bidrequestsArea = document.getElementById('bid-requests-area');
	bidrequestsArea.style.display='none';
	var actionsbidrequestsArea = document.getElementById('actions-bid-requests');
	actionsbidrequestsArea.style.display='none';
	
	var activebidsArea = document.getElementById('active-bids-area');
	activebidsArea.style.display='none';
	var actionsactivebidsArea = document.getElementById('actions-active-bids');
	actionsactivebidsArea.style.display='none';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='block';
	var actionsopenordersArea = document.getElementById('actions-open-orders');
	actionsopenordersArea.style.display='block';
	
	var bidhistoryArea = document.getElementById('bid-history-area');
	bidhistoryArea.style.display='none';
	var actionsbidhistoryArea = document.getElementById('actions-bid-history');
	actionsbidhistoryArea.style.display='none';
}

/*
* param: the tab link user clicked
* focus on the bid history tab
* display the content under the bid history tab
*/
function displayBidHistory(element)
{ 
	clearAuctionDetails()
	document.getElementById("area-title").innerHTML='the bid history';
	activateTab(element, 'br');
	var bidrequestsArea = document.getElementById('bid-requests-area');
	bidrequestsArea.style.display='none';
	var actionsbidrequestsArea = document.getElementById('actions-bid-requests');
	actionsbidrequestsArea.style.display='none';
	
	var activebidsArea = document.getElementById('active-bids-area');
	activebidsArea.style.display='none';
	var actionsactivebidsArea = document.getElementById('actions-active-bids');
	actionsactivebidsArea.style.display='none';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='none';
	var actionsopenordersArea = document.getElementById('actions-open-orders');
	actionsopenordersArea.style.display='none';
	
	var bidhistoryArea = document.getElementById('bid-history-area');
	bidhistoryArea.style.display='block';
	var actionsbidhistoryArea = document.getElementById('actions-bid-history');
	actionsbidhistoryArea.style.display='block';
}

/*
* if the bid that user has placed already, alert to user
* otherwise, jump to the bidresponse page
*/
function updateLinkOfPlaceBid(data)
{
	if(data=='#')
	{
		alert('You have already placed that bid.');
	}
	else
	{
		document.getElementById('place-bid-button').href=data;
		self.location=document.getElementById('place-bid-button').href;
	}
}

/*
* confirm with user if placing the bid, send place bid request
* when click on place bid button
*/
function clickOnPlaceBid(element)
{
	var message='';
	if(previousBidRequestsID==0)
	{
		message+='You didn\'t select an auction.';
	}
	else
	{
		message+='Are you going to place the bid with ID '+previousBidRequestsID+'?';
	}
	var placeBid=window.confirm(message);
	if(placeBid&&previousBidRequestsID!=0)
	{
		$.ajax({
	       url: '<?php echo CController::createUrl('myBids/validateAuction');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {auction_ID:previousBidRequestsID},
	       success: updateLinkOfPlaceBid,
	     });
	}
	return false;
}

/*
* update tables when close order operation succeed
* otherwise, print error
*/
function updateCloseOrders(data)
{
	var tabs=document.getElementsByName('tabs');
	if(data=='close-order-success')
	{
		$('#msg-header').show();
		$('#msg-header').html('Order has been closed successfully. Please wait for the buyer to complete the order.');
		document.getElementById('error-area').innerHTML='';
		updateTables();
		tabs[3].children[0].click();
	}
	else
	{
		for(var key in data)
		{
			document.getElementById('error-area').innerHTML+=data[key]+'</br>';
		}
	}
}

/*
* confirm with user if close the order, send close order request
* when click on close order button
*/
function clickOnCloseOrder()
{
	var message='';
	if(previousOpenOrdersID==0)
	{
		message+='You didn\'t select an order.';
	}
	else
	{
		message+='Are you going to close the order whose ID is '+previousOpenOrdersID+'?';
	}
	var closeOrder=window.confirm(message);
	if(closeOrder)
	{
		$.ajax({
	       url: '<?php echo CController::createUrl('myBids/closeOrder');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {order_ID:previousOpenOrdersID, net_gallons:document.getElementById('net_gallons').value, gross_gallons:document.getElementById('gross_gallons').value},
	       success: updateCloseOrders
	     });
		return false;
	}
	else
	{
		return false;
	}
}

function updateTables()
{
	$.fn.yiiGridView.update('bidrequestsTable');
	$.fn.yiiGridView.update('activebidsTable');
	$.fn.yiiGridView.update('openordersTable');
	$.fn.yiiGridView.update('bidhistoryTable');
}

function selectItem() {
	$('#msg-header').hide();
	$('#msg-header').html('');
}

function clearAuctionDetails() {
	$('#oo-details').html("<p><b>Auction ID:</b></p><p><b>Product:</b></p><p><b>Gallons Req.:</b></p><p><b>Inv. Last Read:</b></p><p><b>Inv. Last Time:</b></p><p><b>Auction Start Date/Time:</b></p><p><b>Auction End Date/Time:</b></p><p><b>Delivery Requested Date/Time:</b></p><p><b>delivery notes</b></p><p><b>auction notes</b></p>");
}

//self.setInterval("updateTables()", 60*1000);//udpate table every min
</script>

<div id="my-bids">
<div id="my-bids-contents">
<div id="my-bids-head">my bids</div>

<div id="active-bids">
<div id="active-bids-container">

<div id="br-menu">
<div class="br-navi">
    <ul>
        <li name='tabs' class="br1 br-active1">
        	<?php echo CHtml::link('Bid Requests','#', array(
									'title' => 'Bid Requests',
									'onclick' => 'displayBidRequests(this)',
											)); ?>
        </li>
        <li name='tabs' class="br2">
        	<?php echo CHtml::link('Active Bids','#', array(
									'title' => 'Active Bids',
									'onclick' => 'displayActiveBids(this)',
											)); ?>
        </li>
        <li name='tabs' class="br3">
        	<?php echo CHtml::link('Open Orders','#', array(
									'title' => 'Open Orders',
									'onclick' => 'displayOpenOrders(this)',
											)); ?>
        </li>
        <li name='tabs' class="br4">
        	<?php echo CHtml::link('Bid History','#', array(
									'title' => 'Bid History',
									'onclick' => 'displayBidHistory(this)',
											)); ?>        
        </li>
    </ul>
</div>
</div><!-- End Mybids Menu -->

<div id="active-bids-contents">
<div id="area-title" class="green-head2">the bid requests</div>

<div id='bid-requests-area' style='display:block'>
<?php
CActiveForm::widget('zii.widgets.grid.CGridView', array(
			    	'dataProvider'=>$bidrequestsDataProvider,
			    	'id'=>'bidrequestsTable',
			    	'selectableRows'=>1,
			    	'selectionChanged'=>'function(id) {' .
						'selectItem();'.
			    		'var columnID = $.fn.yiiGridView.getSelection(id);'.
			    		'if(columnID[0]!=null) previousBidRequestsID=columnID[0];'.
			    		'$.get(
			    			"'.$this->createUrl('myBids/auctionDetails').'",
			    			{ auction_ID: previousBidRequestsID },
			    			function(data){
			    				displayAuctionDetails(data);
			    			},
			    			"json"
	    				);'
			    	.'}',
					'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
					'columns'=>array(
						array(
			    			'name'=>'buyer',
			    			'value'=>'$data["organization_name"]',
			    		),
			    		array(
			    			'name'=>'product',
			    			'value'=>'$data["product_name"]',
			    		),
			    		array(
			    			'name'=>'gals',
			    			'value'=>'$data["gallon"]',
			    		),
			    		array(
			    			'name'=>'end date/time',
			    			'value'=>'date("Y-m-d g:ia", strtotime($data["auction_end"]))'
			    		),
			    	/*	array(
			    			'name'=>'buyer',
			    			'value'=>'$data->tank->tank_name',
			    		),
			    		array(
			    			'name'=>'product',
			    			'value'=>'$data->product->product_name',
			    		),
			    		array(
			    			'name'=>'gals',
			    			'value'=>'$data->gallon',
			    		),
			    		array(
			    			'name'=>'end date/time',
			    			'value'=>'$data->auction_end'
			    		),
						*/
			    	),
				),
				false//captureOutput
			);
?>
</div>
<div id='active-bids-area' style='display:none'>
<?php
CActiveForm::widget('zii.widgets.grid.CGridView', array(
			    	'dataProvider'=>$activebidsDataProvider,
			    	'id'=>'activebidsTable',
			    	'selectableRows'=>1,
			    	'selectionChanged'=>'function(id) {' .
						'selectItem();'.
			    		'var columnID = $.fn.yiiGridView.getSelection(id);'.
			    		'if(columnID[0]!=null) previousActiveBidsID=columnID[0].split(",")[1];'.
			    		'$.get(
			    			"'.$this->createUrl('myBids/auctionDetails').'",
			    			{ auction_ID: previousActiveBidsID },
			    			function(data){
			    				displayAuctionDetails(data);
			    			},
			    			"json"
	    				);'
			    	.'}',
					'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
					'columns'=>array(
			    		array(
			    			'name'=>'buyer',
			    			'value'=>'$data->auction->user->organization->organization_name',
			    		),
			    		array(
			    			'name'=>'product',
			    			'value'=>'$data->auction->product->product_name',
			    		),
			    		array(
			    			'name'=>'bid $',
			    			'value'=>'$data->delivered_price_per_gallon',
			    		),
			    		array(
			    			'name'=>'end date/time',
			    			'value'=>'date("Y-m-d g:ia", strtotime($data->auction->auction_end))'
			    		),
			    	),
				),
				false//captureOutput
			);
?>
</div>

<div id='open-orders-area' style='display:none'>
<?php
CActiveForm::widget('zii.widgets.grid.CGridView', array(
			    	'dataProvider'=>$openordersDataProvider,
			    	'id'=>'openordersTable',
			    	'selectableRows'=>1,
			    	'selectionChanged'=>'function(id) {' .
			    		'selectItem();'.
			    		'var columnID = $.fn.yiiGridView.getSelection(id);'.
			    		'if(columnID[0]!=null) previousOpenOrdersID=columnID[0];'.
			    		'$.get(
			    			"'.$this->createUrl('myBids/orderDetails').'",
			    			{ order_ID: previousOpenOrdersID },
			    			function(data){
			    				displayAuctionDetails(data);
			    			},
			    			"json"
	    				);'
			    	.'}',
					'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
					'columns'=>array(
			    		array(
			    			'name'=>'buyer',
			    			'value'=>'$data->auction->user->organization->organization_name',
			    		),
			    		array(
			    			'name'=>'product',
			    			'value'=>'$data->auction->product->product_name',
			    		),
			    		array(
			    			'name'=>"requested del date/time",
			    			'value'=>'date("Y-m-d g:ia", strtotime($data->auction->delivery_due))',
			    		),
			    	),
				),
				false//captureOutput
			);
?>
</div>

<div id='bid-history-area' style='display:none'>
<?php
CActiveForm::widget('zii.widgets.grid.CGridView', array(
			    	'dataProvider'=>$bidhistoryDataProvider,
			    	'id'=>'bidhistoryTable',
			    	'selectableRows'=>1,
			    	'selectionChanged'=>'function(id) {' .
			    		'selectItem();'.
			    		'var columnID = $.fn.yiiGridView.getSelection(id);'.
			    		'if(columnID[0]!=null) previousBidHistoryID=columnID[0];'.
			    		'$.get(
			    			"'.$this->createUrl('myBids/orderDetails').'",
			    			{ order_ID: previousBidHistoryID },
			    			function(data){
			    				displayAuctionDetails(data);
			    			},
			    			"json"
	    				);'
			    	.'}',
					'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
					'columns'=>array(
						array(
			    			'name'=>'auction ID',
			    			'value'=>'$data->auction->auction_ID',
			    		),
			    		array(
			    			'name'=>'buyer',
			    			'value'=>'$data->auction->user->organization->organization_name',
			    		),
			    		array(
			    			'name'=>'product',
			    			'value'=>'$data->auction->product->product_name',
			    		),
			    		array(
			    			'name'=>"requested del date/time",
			    			'value'=>'date("Y-m-d g:ia", strtotime($data->auction->auction_end))',
			    		),
			    	),
				),
				false//captureOutput
			);
?>
</div>

</div><!-- End Active Bids Contents -->
</div><!-- End Active Bids Container -->
</div><!-- End Active Bids -->
<!--
<div id="won"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/won-icon.gif" alt="" />Won!</div>
<div id="closing"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/closing-icon.gif" alt="" />Closing Hurry!</div>
<div id="lost"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/lost-icon.gif" alt="" />Lost</div>
-->
<div id="my-bids-ch">These people want you to bid today</div>

<div id="br-details-box">
<!--
<div id="aa-sd-button" style='display:block'>
</div>
-->

<div id="bid-details" class="scroll-pane-arrows3">

<div id='auction-details' class="search-auction-cont">
<div id="br-box-heading" class="green-head2" style="position: absolute; top: 5px;">details</div>
<a id='site-details-button' href="#">
	<img src="<?php echo Yii::app()->request->baseUrl; ?>/images/site-details2.gif" alt="" />
</a>
	<div id="oo-details">
		    <p><b>Auction ID:</b></p>
		    <p><b>Product:</b></p>
		    <p><b>Gallons Req.:</b></p>
		    <p><b>Inv. Last Read:</b></p>
		    <p><b>Inv. Last Time:</b></p>
		    <p><b>Auction Start Date/Time:</b></p>
		    <p><b>Auction End Date/Time:</b></p>
		    <p><b>Delivery Requested Date/Time:</b></p>
		    <p><b>delivery notes</b></p>
		    <p><b>auction notes</b></p>
	</div><!-- End Open Order Details -->
</div><!-- End Search Contents -->
</div><!-- End scroll-pane-arrows2 -->

</div><!-- End Br Details Box -->

<div id="br-actions">

<div id="bid-actions" class="scroll-pane-arrows2">
<div id="br-box-heading" class="green-head2" style="position: absolute; top: 5px;">actions</div>
<div id='actions' class="search-auction-cont">
	<div id='actions-bid-requests' style='display:block'>
	<div id='actions-bid-request' style='display:block'>
	<?php
		$imageURI = "<img src='".Yii::app()->request->baseUrl."/images/place-bid.gif' />";
        echo CHtml::link($imageURI,'#', array(
									'onclick'=>'return clickOnPlaceBid(this);',
								//	'id'=>'place-bid-button'
								));
	?>
	</div>
	</div>
	<div id='actions-active-bids' style='display:none'>
	</div>
	<div id='actions-open-orders' style='display:none'>
	<div id='error-area' style='color:#FF0000'></div>
		<div id="net-gross">
	      <table width="100%" border="0" cellspacing="0" cellpadding="0">
	        <tr>
	          <th width="120">net gallons</th>
	          <td><div class="textbox2">
	          	<?php echo CHtml::textField('net_gallons', ''); ?>
	          </div></td>
	        </tr>
	        <tr>
	          <th>gross gallons</th>
	          <td><div class="textbox2">
	          	<?php echo CHtml::textField('gross_gallons', ''); ?>
	          </div></td>
	        </tr>
	      </table>
	    </div>
	    <div id='actions-open-order' style='display:block'>
		<?php
			$imageURI = "<img src='".Yii::app()->request->baseUrl."/images/close-order.gif' />";
	        echo CHtml::link($imageURI,'#', array(
										'onclick'=>'return clickOnCloseOrder();',
										'id'=>'place-bid-button',
									));
		?>
		</div>
	</div>
	<div id='actions-bid-history' style='display:none'>
		<?php
		//	echo CHtml::linkButton('dispute resolution');
		?>
	</div>
	
</div><!-- End search-auction-cont -->
</div><!-- End scroll-pane-arrows2 -->
</div><!-- End br-actions -->


</div><!-- End Bids Contents -->
</div><!-- End Bids -->

<script>
var tabs=document.getElementsByName('tabs');
<?php if($operation=='activebids') {?>
	tabs[1].children[0].click();
<?php } ?>
</script>